const mongoose = require('mongoose');
const Time = require('../public/javascripts/time')
const Schema = mongoose.Schema;

const WriterSchema = new Schema({
    zhanghao: {     //账号
        type: String,
        required: true
    },
    username: {     //用户名
        type: String,
        required: true
    },
    password: {     //密码
        type: String,
        required: true
    },
    twoPass: {      //二级密码
        type:String
    },
    email: {        //邮箱
        type: String,
        required: true
    },
    avatar: {       //头像
        type: String,
        default: 'http://127.0.0.1:3000/uploads/writers/moren.jpg'
    },
    state: {        //状态
        type: String,
        default: 0
    },
    date: {         //创建时间
        type: String,
        default: new Time().getTime()
    },
})

module.exports = Writer = mongoose.model("writers", WriterSchema);